import React, { Component } from 'react'
import { FormattedMessage } from 'react-intl'
import { Icon, NoticeBar } from 'antd-mobile'
import io from 'socket.io-client'

import { FooterBar } from 'component/footer'




export default class ChatPage extends Component {

  connect(namespace) {
    const socket = io('http://127.0.0.1:3000' + namespace, { transports: ['websocket'] })
    return new Promise(resolve => {
      socket.on('connect', () => {
        resolve(socket)
      })
    })
  }

  async componentDidMount() {
    
    let socket = await this.connect('/chat')
    socket.emit('login', localStorage.token)
  }

  render() {
    return (

      <div>
        <div className="cm-scrollable-container rt-bg-grey">
        123
        </div>
        <FooterBar activeIndex={3}/>
      </div>
    )
  }
}
